<html>

<!-- HERE WE GIVE THE PAGE A TITLE -->
<head>
<title>Results Table for Steroid Project</title>
</head>

<body>

<h3>
<?php
		echo "<td>Results for: $survey_name </td>";
?> </h3>

<table border='3'>

<!-- THE FIRST TABLE ROW IS THE ITEM COLUMN NAMES
FOR NOW THIS IS JUST THE ITEM IDS -->
<tr>

<?php

for($i = 0; $i < $num_col; $i++)
{
	if ($i == 0)
	{
		echo "<td><b>User Id</b></td>";
	}
	elseif ($i == 1)
	{
		echo "<td><b>Time Taken</b></td>";
	}
	else
	{
		echo "<td><b> {$item_titles[$i]} </b></td>";
	}
}
echo "</tr>";

for($i = 0; $i < $num_rows; $i++)
{
	echo "<tr>";
	
	for($j = 0; $j < $num_col; $j++)
	{		
			echo "<td> {$fields[$i][$j]} </td>";
	}
	
	echo "</tr>";
}


?>

</body>
</html>

<?php


	function get_item_id($string)
	{
		$num = get_substring($string, "q", "_");

		return $num;
	}
	
		function get_substring($string, $start, $end)
	{
		$string = " ".$string;
		$initial = strpos($string, $start);
	
		if ($initial == 0)
			return "";
	
		$initial = $initial + strlen($start);
	
		$length = strpos($string, $end, $initial) - $initial;
	
		$string_between = substr($string, $initial, $length);
 
		return $string_between;
	}

?>